import type { RouteRecordRaw, RouteLocationNormalized } from 'vue-router';

const general: RouteRecordRaw[] = [
  {
    path: '/generalcard/:game_id',
    name: 'GeneralCardPage',
    component: () => import('/@/views/general/card'),
    meta: {
      title: '单卡',
      keepAlive: true,
    },
    props: (router: RouteLocationNormalized) => {
      return {
        gameId: router.params.game_id ? String(router.params?.game_id) : '',
      };
    },
  },
  {
    path: '/generalcard/:game_id/:id',
    name: 'GeneralCardDetailPage',
    component: () => import('/@/views/general/card-detail'),
    meta: {
      title: '单卡详情',
    },
    props: (router: RouteLocationNormalized) => {
      return {
        gameId: router.params.game_id ? String(router.params?.game_id) : '',
        id: router.params.id ? Number(router.params?.id) : 0,
      };
    },
  },
];

export default general;
